package com.xyht.sca_s.student_manage_system.modules.waterMark.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xyht.sca_s.student_manage_system.common.commonReturn.CommonResult;
import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.modules.waterMark.entity.SmsWaterMarkLogo;
import com.xyht.sca_s.student_manage_system.modules.waterMark.entity.resp.SmsWaterMarkLogoResp;
import com.xyht.sca_s.student_manage_system.modules.waterMark.mapper.SmsWaterMarkLogoMapper;
import com.xyht.sca_s.student_manage_system.modules.waterMark.service.SmsWaterMarkLogoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

import static com.xyht.sca_s.student_manage_system.common.util.ParamCheckUtil.isNullOrEmpty;

/**
 * <p>
 * 合同水印院校图标 服务实现类
 * </p>
 *
 * @author XYHT
 * @since 2024-02-19
 */
@Service
public class SmsWaterMarkLogoServiceImpl extends ServiceImpl<SmsWaterMarkLogoMapper, SmsWaterMarkLogo> implements SmsWaterMarkLogoService {
    @Resource
    private SmsWaterMarkLogoMapper smsWaterMarkLogoMapper;
    @Override
    public ResponseResult getWaterMarkLogoList() {
        List<SmsWaterMarkLogoResp> list = smsWaterMarkLogoMapper.selectList(new QueryWrapper<>())
                .stream()
                .map(logo->{
                    SmsWaterMarkLogoResp smsWaterMarkLogoResp = new SmsWaterMarkLogoResp();
                    BeanUtils.copyProperties(logo,smsWaterMarkLogoResp);

                    return smsWaterMarkLogoResp;
                })
                .collect(Collectors.toList());
        return CommonResult.success(list);
    }
}
